﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
		<Setter Property="Background" Value="{DynamicResource LightBrush}"/>
		<Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
		<Setter Property="Template" Value="{DynamicResource ExpanderControlTemplate}"/>
	</Style>
	<ControlTemplate x:Key="ExpanderControlTemplate" TargetType="{x:Type Expander}">
		<Grid>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="*" x:Name="ContentRow"/>
			</Grid.RowDefinitions>
			<Border Grid.Row="0" x:Name="Border" BorderThickness="{DynamicResource ThicknessSize_1}" CornerRadius="{DynamicResource CornerRadiusSmall}" Background="{DynamicResource BrushControlBackgroundLight}" BorderBrush="{DynamicResource ImpassiveColor4}">
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="20"/>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>
					<ToggleButton Template="{DynamicResource ExpanderToggleButtonControlTemplate}" Background="{DynamicResource NormalBrush}" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" OverridesDefaultStyle="True"/>
					<ContentPresenter Grid.Column="1" Margin="4" RecognizesAccessKey="True" ContentSource="Header"/>
				</Grid>
			</Border>
			<Border Visibility="Collapsed" Grid.Row="1" x:Name="ExpandSite" Background="{x:Null}" BorderBrush="{x:Null}" BorderThickness="1,0,1,1" CornerRadius="0,0,2,2">
				<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Focusable="false"/>
			</Border>
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="IsExpanded" Value="True">
				<Setter Property="Visibility" Value="Visible" TargetName="ExpandSite"/>
			</Trigger>
			<Trigger Property="IsEnabled" Value="False">
				<Setter Property="Background" Value="{DynamicResource DisabledBackgroundBrush}" TargetName="Border"/>
				<Setter Property="BorderBrush" Value="{DynamicResource DisabledBorderBrush}" TargetName="Border"/>
				<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>
	<ControlTemplate x:Key="ExpanderToggleButtonControlTemplate" TargetType="{x:Type ToggleButton}">
		<Grid>
			<Border BorderBrush="{DynamicResource ImpassiveColor4}" BorderThickness="0,0,1,0" x:Name="border" CornerRadius="3,0,0,3" Background="{DynamicResource BrushControlBackgroundLight}"/>
			<Path HorizontalAlignment="Center" x:Name="Up_Arrow" VerticalAlignment="Center" Fill="{DynamicResource GlyphBrush}" Data="M 0 0 L 4 4 L 8 0 Z"/>
			<Path Visibility="Collapsed" HorizontalAlignment="Center" x:Name="Down_Arrow" VerticalAlignment="Center" Fill="{DynamicResource GlyphBrush}" Data="M 0 4 L 4 0 L 8 4 Z"/>
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="IsMouseOver" Value="true">
				<Setter Property="Background" TargetName="border" Value="{DynamicResource BrushControlBackgroundLightFocused}"/>
			</Trigger>
			<Trigger Property="IsPressed" Value="true">
				<Setter Property="Background" TargetName="border" Value="{DynamicResource BrushControlBackgroundLightPressed}"/>
			</Trigger>
			<Trigger Property="IsChecked" Value="true">
				<Setter Property="Visibility" Value="Visible" TargetName="Down_Arrow"/>
				<Setter Property="Visibility" Value="Collapsed" TargetName="Up_Arrow"/>
			</Trigger>
			<Trigger Property="IsEnabled" Value="False">
				<Setter Property="Foreground" Value="{DynamicResource DisabledForegroundBrush}"/>
				<Setter Property="Fill" Value="{DynamicResource DisabledForegroundBrush}" TargetName="Up_Arrow"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>
	<!-- Resource dictionary entries should be defined here. -->
</ResourceDictionary>